<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<!DOCTYPE html>
<html>
<head>
    <%@ include file="/include/tasklibs.jsp" %>
    <style>
        .mainInfo {
            background-color: #FFF;
            padding: 26px 23px;
        }

        .row {
            margin-bottom: 15px;
        }

        .title {
            text-align: right;
        }

        .btn-default {
            background-color: #2F4050;
        }

        .taskType {
            width: 65px;
            height: 65px;
            border-radius: 100px;
            text-align: center;
            color: #FFF;
            line-height: 65px;
            background-color: #293846;
            float: left;
            font-size: 18px;
        }

        .taskName {
            float: left;
            height: 65px;
            line-height: 65px;
            margin-left: 25px;
            font-size: 24px;
            color: #333333;
        }

        .taskStatus {
            padding-top: 34px;
            padding-bottom: 34px;
            font-size: 16px;
        }

        .normalInfo {
            color: #666666;
            font-size: 14px;
        }

        .signInfo {
            padding: 10px 15px;
        }
    </style>
<div class="mainInfo">
	<button class="btn btn-default" type="button" onclick="goBack()">返回</button>
    <form method="post" class="form-horizontal" action="<c:url value="/child/checkChildTask.json" />">
        <input type="hidden" name="id" value="${child.id}">
        <input type="hidden" id="id" value="${child.parentTaskId }">
        <input type="hidden" id="status" name="status" value="PASS">

        <div class="row">
            <div class="col-md-8">
                <div class="taskType">
                    ${taskType }
                </div>
                <div class="taskName">
                    ${child.parentTask.taskName}
                </div>
            </div>
            <div class="col-md-2 col-md-offset-2 taskStatus">
                状态：<span class="ing">${status}</span>
            </div>
        </div>
        <div class="row">
            <div class="col-md-2 title">
                任务时效：
            </div>
            <div class="col-md-3 taskTime normalInfo">
                ${child.parentTask.startTime } ~ ${child.parentTask.endTime }
            </div>
            <div class="col-md-3 normalInfo">
                门店信息：${child.store.storeName } ${child.store.storeAddress }
            </div>
            <div class="col-md-3 normalInfo">
                赏金：${child.parentTask.rewardName}
            </div>
        </div>
        <div class="row">
            <div class="col-md-2 taskTime normalInfo title">
                任务描述：
            </div>
            <div class="col-md-8">
                <textarea id="requireEditor" autofocus>
                    ${child.parentTask.taskRequire }
                </textarea>
            </div>
        </div>
        <div class="row">
            <div class="col-md-2 taskTime normalInfo title">
                任务指引：
            </div>
            <div class="col-md-8">
                <textarea id="guideEditor" disabled>
                    ${child.parentTask.taskGuidanceWords }
                </textarea>
            </div>
            <div class="col-md-8 col-md-offset-2 signInfo">
                签到时间：<fmt:formatDate value="${child.pickUpTime}" pattern="yyyy/MM/dd HH:mm:ss"/>
                签到位置：${child.pickAddress}
                签到人：${userName}
            </div>
        </div>

        <div class="row" >
        	<div class="col-md-2 normalInfo title">
			执行情况：
		   </div>
            <div class="col-md-8" >
                <div id="gallery" class="gallery" style="margin-bottom: 30px;">
                    <c:forEach var="imageUrl" items="${imageUrls}" varStatus="status">
                        <a href="${imageUrl}" title=""><img style="width:150px;height:150px;" src="${imageUrl}"></a>
                    </c:forEach>
                </div>
            </div>
            <div class="col-md-8 col-md-offset-2 signInfo">
                文字说明：${content}
            </div>

            <c:if test="${child.status=='SUBMIT'}">
            <div class="row">
                <div class="col-md-2 col-md-offset-5">
                    <button class="btn btn-default" type="submit">审核通过</button>
                </div>
                <div class="col-md-2">
                    <button class="btn btn-default" type="submit" onmousedown="changeStatus(1)">审核不通过</button>
                </div>
            </div>
            </c:if>
    </form>
</div>
<script>
    function goBack(){
    	var id = $("#id").val();
    	$('.J_iframe').load('web/mainTaskDetail.html?id='+id);
    }
    function changeStatus(va) {
        if (1 == va) {
            $("#status").val("NOPASS");
        }
    }
    var Controller = {
        initEditor: function () {
            var requireEditor = new Simditor({
                textarea: $('#requireEditor'),
                toolbar: false
            });
            var guideEditor = new Simditor({
                textarea: $('#guideEditor'),
                toolbar: false
            });
        },
        initRebox: function () {
            $('#gallery').rebox({ selector: 'a' });
            $('#gallery').bind('rebox:open', function (e) {
                $('.rebox').width($('.J_iframe').width() + 70);
                $('.rebox').appendTo($('.J_iframe'));
            });

        },
        init: function () {
            Controller.initEditor();
            Controller.initRebox();
        }
    }

    $(function () {
        Controller.init();
        $(".simditor-body").attr("contenteditable",false);
    });
</script>